# -*- coding: utf-8 -*- 
# @Time : 2020/4/26 21:41 
# @Author : ganwei 
# @File : 104.py
# @desc : leet code 104 二叉树的最大深度
class TreeNode(object):
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None


def solution(root):
    print("hello")
    if root == None:
        return 0
    return viewtree(root)

def viewtree(p):
    if p == None:
        return 0
    if p.left == None and p.right == None:
        return 1
    return max(1+viewtree(p.left),1+viewtree(p.right))



if __name__ == "__main__":
    print("hello")
    head = TreeNode(1)
    left = TreeNode(2)
    right = TreeNode(2)
    head.left = left
    head.right = right
    print(solution(head))